package com.fansl.allround.study.designpattern.singleton;

/**
 * @author fansl
 * @Description: TODO
 * @date 2019/10/11 11:26
 */
public class SingletonTest {
    public static void main(String[] args) {
        LazySingleton lazySingleton = LazySingleton.getInstance();
        lazySingleton.setName("lazySingleton");
        LazySingleton lazySingleton1 = LazySingleton.getInstance();
        lazySingleton1.setName("lazySingleton1");
        System.out.println(lazySingleton.getName());
        System.out.println(lazySingleton1.getName());

        ImmediateSingleton immediateSingleton = ImmediateSingleton.getImmediateSingleton();
        immediateSingleton.setName("immediateSingleton");
        ImmediateSingleton immediateSingleton1 = ImmediateSingleton.getImmediateSingleton();
        immediateSingleton1.setName("immediateSingleton1");
        System.out.println(immediateSingleton.getName());
        System.out.println(immediateSingleton1.getName());
    }
}
